<?php
header("Access-Control-Allow-Origin: https://shop.shante.me");
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>闪特云数字化工作平台</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
        }
        .title-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background-color: #333;
            color: #fff;
            padding: 10px;
            -webkit-app-region: drag;
        }
        .title-bar .title {
            display: flex;
            align-items: center;
        }
        .title-bar img {
            height: 20px;
            margin-right: 10px;
        }
        .title-bar .buttons {
            display: flex;
            align-items: center;
        }
        .title-bar .buttons button {
            background: none;
            border: none;
            color: #fff;
            font-size: 16px;
            margin-left: 10px;
            cursor: pointer;
            -webkit-app-region: no-drag;
        }
        .container {
            display: flex;
            height: calc(100vh - 40px);
        }
        .menu {
            width: 200px;
            background-color: #f4f4f4;
            border-right: 1px solid #ddd;
            padding: 10px;
            margin: 0;
        }
        .menu ul li{
            list-style: none;
            height:32px;
            width:100px;
        }

        .menu ul li a{
            text-decoration: none;
            color:#000;
        }
        .content {
            flex: 1;
            padding: 0; /* 移除内边距 */
            overflow: hidden; /* 防止出现滚动条 */
        }
        .content iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
        body {
            overflow-y: hidden;
        }
        .title-bar{
            display: list-item;
            align-items: center;
            justify-content: space-between;
            background-color: #FFFFFF;
            color: #fff;
            padding: 10px;
            -webkit-app-region: drag;
            border-bottom: 1px solid #ddd;
        }
        .title-bar a{
            float: left;
            margin-left: 10px;
            color: #fff;
            text-align: center;
            text-decoration: none;
            height: 20px;
            width: 120px;
            display: block;
            background: dodgerblue;
            padding: 1px;
        }
        body {
            font-family: Arial, sans-serif;
        }
        .menu {
            list-style-type: none;
            padding-left: 20px;
        }
        .menu-item {
            cursor: pointer;
            position: relative;
            padding-left: 30px;
            margin-top: 11px;
        }
        .menu-item::before {
            content: '+';
            position: absolute;
            left: 0;
            top: 0;
            width: 20px;
            height: 20px;
            line-height: 20px;
            text-align: center;
            background-color: #eee;
            border: 1px solid #ccc;
        }
        .menu-item.expanded::before {
            content: '-';
        }
        .submenu {
            display: none;
            padding-left: 20px;
        }
        .submenu.expanded {
            display: block;
        }
    </style>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div class="title-bar">
    <button id="bookmarkBtn">+</button>
    <button id="goBackBtn"><-</button>
    <button id="goForwardBtn">-></button>
    <button id="collect">抓取</button>
    <button id="luru">录入</button>
</div>

<script>
    try {
        const {webview} = require('electron').remote;
        const {ipcRenderer} = require('electron');
        const { remote } = require('electron');
        const win = remote.getCurrentWindow();
    }catch(e){

    }
    const webviewEl = document.getElementById('webview');
    const bookmarkBtn = document.getElementById('bookmarkBtn');
    const goBackBtn = document.getElementById('goBackBtn');
    const goForwardBtn = document.getElementById('goForwardBtn');

    bookmarkBtn.addEventListener('click', () => {
        const bookmark = {
            url: webviewEl.getURL(),
            title: webviewEl.getTitle()
        };
        sessionStorage.setItem('bookmark', JSON.stringify(bookmark));
        console.log('Bookmark added:', bookmark);
    });

    goBackBtn.addEventListener('click', () => {
        ipcRenderer.send('go-back');
    });

    goForwardBtn.addEventListener('click', () => {
        ipcRenderer.send('go-forward');
    });
</script>
<div class="container">
    <ul class="menu">
        <li class="menu-item">闪特云仓
            <ul class="submenu">
                <li id="menu-item-1" target="webview" href="https://shop.shante.me/Shop/Item/index.html" class="menu-item">我的云仓</li>
                <li class="menu-item" target="webview" href="https://shop.shante.me/" class="menu-item">闪特商品</li>
            </ul>
        </li>
        <li class="menu-item">AI人工智能
            <ul class="submenu">
                <li class="menu-item" id="menu-item-2" target="_blank" href="https://chatgpt.com/">ChatGpt</li>
                <li class="menu-item" target="webview" href="https://www.doubao.com/chat/">豆包</li>
                <li class="menu-item" target="webview" href="https://yiyan.baidu.com/">文心一言</li>
                <li class="menu-item" target="webview" href="https://yiyan.baidu.com/">Midjourney AI绘图</li>
                <li class="menu-item" target="webview" href="https://yiyan.baidu.com/">Stablediffusion专业绘图</li>
                <li class="menu-item" target="webview" href="https://yiyan.baidu.com/">BingChat</li>
            </ul>
        </li>
        <li class="menu-item">直播考评
            <ul class="submenu">
                <li class="menu-item" target="webview" href="http://t.yangjc.com/">AI直播话术</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">直播测评平台</li>
            </ul>
        </li>
        <li class="menu-item">视频工具
            <ul class="submenu">
                <li class="menu-item" target="webview" href="http://t.yangjc.com/">视频智能文案</li>
                <li class="menu-item" target="webview" href="http://t.yangjc.com/">视频素材采集</li>
                <li class="menu-item" target="webview" href="http://t.yangjc.com/">视频去水印</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">视频下载</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">视频去重</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">视频提取文字</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">视频提取音乐</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">视频提取人声</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">批量发视频</li>
            </ul>
        </li>
        <li class="menu-item">文章工具
            <ul class="submenu">
                <li class="menu-item" target="webview" href="http://t.yangjc.com/">文章抓取</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">AI写作</li>
                <li class="menu-item" target="webview" href="https://t.yangjc.com/">批量发文</li>
            </ul>
        </li>
        <li class="menu-item">店商工具
            <ul class="submenu">
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.1</li>
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.2</li>
            </ul>
        </li>
        <li class="menu-item">热销商品
            <ul class="submenu">
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.1</li>
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.2</li>
            </ul>
        </li>
        <li class="menu-item">雷爆信息
            <ul class="submenu">
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.1</li>
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.2</li>
            </ul>
        </li>
        <li class="menu-item">科学上网
            <ul class="submenu">
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.1</li>
                <li class="menu-item" target="webview" href="https://shop.shante.me/">Submenu 3.2</li>
            </ul>
        </li>
        <li class="menu-item">购买服务
            <ul class="submenu">
                <li class="menu-item" target="webview" href="http://www.shante.me/">我的订单</li>
            </ul>
        </li>
        <li class="menu-item">关于闪特
            <ul class="submenu">
                <li class="menu-item" target="webview" href="http://www.shante.me/">闪特官网</li>
            </ul>
        </li>
    </ul>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            var menuItems = document.querySelectorAll('.menu-item');
            menuItems.forEach(function(menuItem) {
                menuItem.addEventListener('click', function(event) {
                    event.stopPropagation();
                    var submenu = this.querySelector('.submenu');
                    if (submenu) {
                        submenu.classList.toggle('expanded');
                        this.classList.toggle('expanded');
                    }
                });
            });
        });

        $('.menu-item').click(function(e) {
            if ($(this).attr('href')) {
                e.preventDefault();
                if($(this).attr('target')=="blank"&&window.electron){
                    window.electron.openExternal(link);
                }else {
                    window.open($(this).attr('href'), $(this).attr('target'));
                }
            }
        });

        function openLink(link) {
            // 这里假设 electron 已经注入了相关接口

        }

    </script>




    <div class="content">
        <iframe name="webview" id="webview" src="https://shop.shante.me/" partition="persist:main"></iframe>
    </div>
</div>


</body>
</html>

